__require = function e(t, n, r) {
  function s(o, u) {
    if (!n[o]) {
      if (!t[o]) {
        var b = o.split("/");
        b = b[b.length - 1];
        if (!t[b]) {
          var a = "function" == typeof __require && __require;
          if (!u && a) return a(b, !0);
          if (i) return i(b, !0);
          throw new Error("Cannot find module '" + o + "'");
        }
      }
      var f = n[o] = {
        exports: {}
      };
      t[o][0].call(f.exports, function(e) {
        var n = t[o][1][e];
        return s(n || e);
      }, f, f.exports, e, t, n, r);
    }
    return n[o].exports;
  }
  var i = "function" == typeof __require && __require;
  for (var o = 0; o < r.length; o++) s(r[o]);
  return s;
}({
  DataState: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "b348caK1ypIZ7aQpvzpUAvK", "DataState");
    "use strict";
    var $ = require("Yvan");
    var priceBaseTable = [ "100", "1500", "6750", "18000", "34476", "77916", "176091", "397966", "899403", "2033K", "4594K", "10382K", "23463K", "53027K", "119841K", "270840K", "612099K", "1383M", "3126M", "7066M", "15968M", "36088M", "81559M", "184324M", "416571M", "941451M", "2034G", "4392G", "9488G", "20493G", "44266G", "95614G", "206526G", "446096G", "963566G", "2081T", "4496T", "9711T", "20975T", "45305T", "97860T", "211377T", "456574T", "986201T", "2130P", "4601P", "9939P", "21467P", "46369P", "100157P" ];
    var PRICE_RISES = 135;
    var PRICE_RISES_PERS = 2;
    var pointBaseTable = [ "5", "10", "17", "20", "26", "35", "47", "62", "80", "101", "125", "152", "182", "215", "251", "290", "332", "377", "425", "476", "530", "587", "647", "710", "776", "845", "917", "992", "1070", "1151", "1235", "1322", "1412", "1505", "1601", "1700", "1802", "1907", "1907" ];
    var POINT_RISES = 1.35;
    var POINT_RISES_PERS = 2;
    var markMoney = [ "50", "100", "200", "400", "800", "1600", "3200", "6400", "12800", "25600", "51200", "102K", "204K", "409K", "819K", "1638K", "3276K", "6553K", "13107K", "26214K", "52428K", "104M", "209M", "419M", "838M", "1677M", "3355M", "6710M", "13421M", "26843M", "53687M", "107G", "214G", "429G", "858G", "1717G", "3435G", "6871G" ];
    var markMoneySpeed = [ "50", "48", "47", "46", "45", "44", "42", "41", "40", "39", "38", "36", "35", "34", "33", "32", "31", "29", "28", "27", "26", "25", "23", "22", "21", "20", "19", "18", "16", "15", "14", "13", "12", "10", "9", "8", "7", "6" ];
    var levelName = [ "\u7ec3\u6c14\u524d\u671f", "\u7ec3\u6c14\u4e2d\u671f", "\u7ec3\u6c14\u540e\u671f", "\u7b51\u57fa\u524d\u671f", "\u7b51\u57fa\u4e2d\u671f", "\u7b51\u57fa\u540e\u671f", "\u7ed3\u4e39\u524d\u671f", "\u7ed3\u4e39\u4e2d\u671f", "\u7ed3\u4e39\u540e\u671f", "\u5143\u5a74\u524d\u671f", "\u5143\u5a74\u4e2d\u671f", "\u5143\u5a74\u540e\u671f", "\u5316\u795e\u524d\u671f", "\u5316\u795e\u4e2d\u671f", "\u5316\u795e\u540e\u671f", "\u7ec3\u865a\u524d\u671f", "\u7ec3\u865a\u4e2d\u671f", "\u7ec3\u865a\u540e\u671f", "\u5408\u4f53\u524d\u671f", "\u5408\u4f53\u4e2d\u671f", "\u5408\u4f53\u540e\u671f", "\u5927\u6210\u524d\u671f", "\u5927\u6210\u4e2d\u671f", "\u5927\u6210\u540e\u671f", "\u771f\u4ed9\u524d\u671f", "\u771f\u4ed9\u4e2d\u671f", "\u771f\u4ed9\u540e\u671f", "\u91d1\u4ed9\u524d\u671f", "\u91d1\u4ed9\u4e2d\u671f", "\u91d1\u4ed9\u540e\u671f", "\u592a\u4e59\u524d\u671f", "\u592a\u4e59\u4e2d\u671f", "\u592a\u4e59\u540e\u671f", "\u5927\u7f57\u524d\u671f", "\u5927\u7f57\u4e2d\u671f", "\u5927\u7f57\u540e\u671f", "\u9053\u7956\u524d\u671f", "\u9053\u7956\u4e2d\u671f", "\u9053\u7956\u540e\u671f" ];
    var LEVEL_MAX = 39;
    var BUY_SKIP = 4;
    var POINT_SKIP = 2;
    var MAKE_MONEY_INTERVAL = 0;
    var EVENT = {
      MONEY_CHANGE: "moneyChange",
      LOAD_SEAT: "onLoadSeat",
      SPEED_CHANGE: "speedChange",
      MAKE_MONEY: "makeMoney",
      POINT_CHANGE: "pointChange",
      ROLE_DISCOVERY: "roleDiscovery",
      MAX_ROLE_PRICE_CHANGE: "maxRolePriceChange",
      ROLE_PRICE_CHANGE: "rolePriceChange"
    };
    var serverUrl = function serverUrl(path) {
      return "http://merge.good5you.com/api" + path;
    };
    function saveSeat() {
      var me = this;
    }
    function emit(me, event, detail) {
      me.component.node.emit(event, detail);
    }
    function setMoney(me, value) {
      value = $.parse(value);
      if (me.state.money !== value) {
        me.state.money = value;
        emit(me, EVENT.MONEY_CHANGE, me.state.money);
      }
      return me.state.money;
    }
    function subMoney(me, subValue) {
      if (!$.isGreat(me.state.money, subValue)) return {
        success: false,
        msg: "\u91d1\u989d\u4e0d\u591f"
      };
      return setMoney(me, $.sub(me.state.money, subValue));
    }
    function addMoney(me, addValue) {
      return setMoney(me, $.add(me.state.money, addValue));
    }
    module.exports = {
      load: function load(component, userId) {
        var me = this;
        me.component = component;
        var userId = 1;
        me.state.userId = userId;
        $.get({
          url: serverUrl("/state"),
          data: {
            userId: userId
          },
          success: function success(root) {
            if (!root.success) {
              self.alert(JSON.stringify(root));
              return;
            }
            var userAccount = root.data.userAccount;
            var userInfo = root.data.userInfo;
            $.extend(me.state, {
              seatArray: JSON.parse(userAccount.seatArray),
              buyCount: JSON.parse(userAccount.buyCount),
              pointCount: JSON.parse(userAccount.pointCount),
              point: userAccount.point
            });
            var roleDiscoved = 0;
            for (var i = 0; i < me.state.seatArray.length; i++) me.state.seatArray[i] > roleDiscoved && (roleDiscoved = me.state.seatArray[i]);
            me.state.roleDiscoved = roleDiscoved;
            setMoney(me, userAccount.money + userAccount.moneyUnit);
            emit(me, EVENT.LOAD_SEAT, me.getState());
            var buyRoleMax = roleDiscoved - BUY_SKIP;
            buyRoleMax < 0 && (buyRoleMax = 0);
            emit(me, EVENT.MAX_ROLE_PRICE_CHANGE, {
              maxRoleLevel: buyRoleMax,
              maxRolePrice: me.getPrice(buyRoleMax)
            });
          },
          error: function error() {
            console.log("errror");
          }
        });
      },
      getPrice: function getPrice(level) {
        if (level >= LEVEL_MAX) return null;
        var buyRoleMax = this.state.roleDiscoved - BUY_SKIP;
        buyRoleMax < 0 && (buyRoleMax = 0);
        if (level > buyRoleMax) return null;
        var buyCount = level >= this.state.buyCount.length ? 0 : this.state.buyCount[level];
        var basePrice = $.parse(priceBaseTable[level]);
        for (var i = 0; i < buyCount; i++) basePrice = $.mul(basePrice, PRICE_RISES).slice(0, -PRICE_RISES_PERS);
        return basePrice;
      },
      getPoint: function getPoint(level) {
        if (level >= LEVEL_MAX) return null;
        if (level > this.state.roleDiscoved - POINT_SKIP) return null;
        if (level <= this.state.roleDiscoved - BUY_SKIP) return null;
        var pointCount = level >= this.state.pointCount.length ? 0 : this.state.pointCount[level];
        var basePrice = $.parse(pointBaseTable[level]);
        for (var i = 0; i < pointCount; i++) basePrice = $.mul(basePrice, POINT_RISES).slice(0, -POINT_RISES_PERS);
        return basePrice;
      },
      getMakeMoneyInterval: function getMakeMoneyInterval(level) {
        var me = this;
        if (level < 0 || level >= 50) return {
          interval: -1,
          money: "0"
        };
        return markMoneySpeed[level] * MAKE_MONEY_INTERVAL;
      },
      makeMoney: function makeMoney(level) {
        var me = this;
        var money = markMoney[level];
        addMoney(me, money);
        return money;
      },
      merge: function merge(seatArray, mergeSuccess, mergedSeat) {
        var me = this;
        if ("boolean" === $.type(mergeSuccess)) {
          console.log("merge-success", seatArray);
          if (seatArray[mergedSeat] > LEVEL_MAX) {
            console.error("\u975e\u6cd5\u89d2\u8272:" + seatArray[mergedSeat]);
            return;
          }
          me.state.seatArray = seatArray;
          if (seatArray[mergedSeat] > me.state.roleDiscoved) {
            me.state.roleDiscoved = seatArray[mergedSeat];
            if (me.onRoleDiscovery) {
              var pointInc = 0;
              var moneyInc = 0;
              me.onRoleDiscovery(me.state.roleDiscoved, pointInc, moneyInc);
            }
            var buyRoleMax = me.state.roleDiscoved - BUY_SKIP;
            buyRoleMax < 0 ? buyRoleMax = 0 : buyRoleMax >= LEVEL_MAX - BUY_SKIP && (buyRoleMax = LEVEL_MAX - BUY_SKIP - 1);
            emit(me, EVENT.MAX_ROLE_PRICE_CHANGE, {
              maxRoleLevel: buyRoleMax,
              maxRolePrice: me.getPrice(buyRoleMax)
            });
          }
        } else me.state.seatArray = seatArray;
        saveSeat();
      },
      buyRole: function buyRole(useWhat, roleLevel, seatPos) {
        var me = this;
        if (roleLevel < 0 || roleLevel >= LEVEL_MAX - BUY_SKIP) {
          console.error("\u9519\u8bef\u7684\u89d2\u8272\u7ea7\u522b" + roleLevel);
          return;
        }
        if ("price" === useWhat) {
          var price = me.getPrice(roleLevel);
          var r = subMoney(me, price);
          if ("string" === $.type(r)) {
            me.state.seatArray[seatPos] = roleLevel;
            var b = me.state.buyCount[roleLevel];
            "number" === $.type(b) ? me.state.buyCount[roleLevel] = b + 1 : me.state.buyCount[roleLevel] = 1;
            emit(me, EVENT.ROLE_PRICE_CHANGE, {
              roleLevel: roleLevel,
              rolePoint: me.getPoint(roleLevel),
              rolePrice: me.getPrice(roleLevel)
            });
            roleLevel >= me.state.roleDiscoved - BUY_SKIP && emit(me, EVENT.MAX_ROLE_PRICE_CHANGE, {
              maxRoleLevel: roleLevel,
              maxRolePrice: me.getPrice(roleLevel)
            });
            return true;
          }
          return r.msg;
        }
        if ("point" === useWhat) return "\u6682\u4e0d\u652f\u6301";
      },
      buyRoleMax: function buyRoleMax(seatPos) {
        var me = this;
        var buyRoleMax = me.state.roleDiscoved - BUY_SKIP;
        buyRoleMax < 0 && (buyRoleMax = 0);
        buyRoleMax > LEVEL_MAX - BUY_SKIP && (buyRoleMax = LEVEL_MAX - BUY_SKIP);
        var v = me.buyRole("price", buyRoleMax, seatPos);
        if ("string" === $.type(v)) return v;
        if (v) return buyRoleMax;
      },
      getPriceList: function getPriceList() {
        var me = this;
        var r = [];
        for (var i = 0; i < LEVEL_MAX; i++) r.push({
          levelName: levelName[i],
          mask: i > me.state.roleDiscoved,
          point: me.getPoint(i),
          price: me.getPrice(i)
        });
        return r;
      },
      getState: function getState() {
        var me = this;
        return me.state;
      },
      getLevelName: function getLevelName(level) {
        return levelName[level];
      },
      EVENT: EVENT,
      state: {
        userId: null,
        buyCount: [],
        pointCount: [],
        seatArray: [],
        roleDiscoved: 0,
        point: 0,
        money: "0"
      }
    };
    cc._RF.pop();
  }, {
    Yvan: "Yvan"
  } ],
  HelloWorld: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "280c3rsZJJKnZ9RqbALVwtK", "HelloWorld");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        label: {
          default: null,
          type: cc.Label
        },
        text: "Hello, World!"
      },
      onLoad: function onLoad() {
        this.label.string = this.text;
      },
      update: function update(dt) {}
    });
    cc._RF.pop();
  }, {} ],
  Yvan: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "b190993e75OZY6qHz3ybp/9", "Yvan");
    "use strict";
    var _typeof = "function" === typeof Symbol && "symbol" === typeof Symbol.iterator ? function(obj) {
      return typeof obj;
    } : function(obj) {
      return obj && "function" === typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
    module.exports = function() {
      var r20 = /%20/g;
      var class2type = {
        "[object Boolean]": "boolean",
        "[object Number]": "number",
        "[object String]": "string",
        "[object Function]": "function",
        "[object Array]": "array",
        "[object Date]": "date",
        "[object RegExp]": "regexp",
        "[object Object]": "object"
      };
      var unit = [ "", "K", "M", "G", "T", "P", "E", "Z", "Y", "D", "N", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AM", "AN", "AO", "AP", "AQ", "AR", "AS", "AT", "AU", "AV", "AW", "AX", "AY", "AZ", "BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BK", "BL", "BM", "BN", "BO", "BP", "BQ", "BR", "BS", "BT", "BU", "BV", "BW", "BX", "BY", "BZ", "CA", "CB", "CC", "CD", "CE", "CF", "CG", "CH", "CI", "CJ", "CK", "CL", "CM", "CN", "CO", "CP", "CQ", "CR", "CS", "CT", "CU", "CV", "CW", "CX", "CY", "CZ", "DA", "DB", "DC", "DD", "DE", "DF", "DG", "DH", "DI", "DJ", "DK", "DL", "DM", "DN", "DO", "DP", "DQ", "DR", "DS", "DT", "DU", "DV", "DW", "DX", "DY", "DZ", "EA", "EB", "EC", "ED", "EE", "EF", "EG", "EH", "EI", "EJ", "EK", "EL", "EM", "EN", "EO", "EP", "EQ", "ER", "ES", "ET", "EU", "EV", "EW", "EX", "EY", "EZ", "FA", "FB", "FC", "FD", "FE", "FF", "FG", "FH", "FI", "FJ", "FK", "FL", "FM", "FN", "FO", "FP", "FQ", "FR", "FS", "FT", "FU", "FV", "FW", "FX", "FY", "FZ", "GA", "GB", "GC", "GD", "GE", "GF", "GG", "GH", "GI", "GJ", "GK", "GL", "GM", "GN", "GO", "GP", "GQ", "GR", "GS", "GT", "GU", "GV", "GW", "GX", "GY", "GZ", "HA", "HB", "HC", "HD", "HE", "HF", "HG", "HH", "HI", "HJ", "HK", "HL", "HM", "HN", "HO", "HP", "HQ", "HR", "HS", "HT", "HU", "HV", "HW", "HX", "HY", "HZ", "IA", "IB", "IC", "ID", "IE", "IF", "IG", "IH", "II", "IJ", "IK", "IL", "IM", "IN", "IO", "IP", "IQ", "IR", "IS", "IT", "IU", "IV", "IW", "IX", "IY", "IZ", "JA", "JB", "JC", "JD", "JE", "JF", "JG", "JH", "JI", "JJ", "JK", "JL", "JM", "JN", "JO", "JP", "JQ", "JR", "JS", "JT", "JU", "JV", "JW", "JX", "JY", "JZ", "KA", "KB", "KC", "KD", "KE", "KF", "KG", "KH", "KI", "KJ", "KK", "KL", "KM", "KN", "KO", "KP", "KQ", "KR", "KS", "KT", "KU", "KV", "KW", "KX", "KY", "KZ", "LA", "LB", "LC", "LD", "LE", "LF", "LG", "LH", "LI", "LJ", "LK", "LL", "LM", "LN", "LO", "LP", "LQ", "LR", "LS", "LT", "LU", "LV", "LW", "LX", "LY", "LZ", "MA", "MB", "MC", "MD", "ME", "MF", "MG", "MH", "MI", "MJ", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NB", "NC", "ND", "NE", "NF", "NG", "NH", "NI", "NJ", "NK", "NL", "NM", "NN", "NO", "NP", "NQ", "NR", "NS", "NT", "NU", "NV", "NW", "NX", "NY", "NZ", "OA", "OB", "OC", "OD", "OE", "OF", "OG", "OH", "OI", "OJ", "OK", "OL", "OM", "ON", "OO", "OP", "OQ", "OR", "OS", "OT", "OU", "OV", "OW", "OX", "OY", "OZ", "PA", "PB", "PC", "PD", "PE", "PF", "PG", "PH", "PI", "PJ", "PK", "PL", "PM", "PN", "PO", "PP", "PQ", "PR", "PS", "PT", "PU", "PV", "PW", "PX", "PY", "PZ", "QA", "QB", "QC", "QD", "QE", "QF", "QG", "QH", "QI", "QJ", "QK", "QL", "QM", "QN", "QO", "QP", "QQ", "QR", "QS", "QT", "QU", "QV", "QW", "QX", "QY", "QZ", "RA", "RB", "RC", "RD", "RE", "RF", "RG", "RH", "RI", "RJ", "RK", "RL", "RM", "RN", "RO", "RP", "RQ", "RR", "RS", "RT", "RU", "RV", "RW", "RX", "RY", "RZ", "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SP", "SQ", "SR", "SS", "ST", "SU", "SV", "SW", "SX", "SY", "SZ", "TA", "TB", "TC", "TD", "TE", "TF", "TG", "TH", "TI", "TJ", "TK", "TL", "TM", "TN", "TO", "TP", "TQ", "TR", "TS", "TT", "TU", "TV", "TW", "TX", "TY", "TZ", "UA", "UB", "UC", "UD", "UE", "UF", "UG", "UH", "UI", "UJ", "UK", "UL", "UM", "UN", "UO", "UP", "UQ", "UR", "US", "UT", "UU", "UV", "UW", "UX", "UY", "UZ", "VA", "VB", "VC", "VD", "VE", "VF", "VG", "VH", "VI", "VJ", "VK", "VL", "VM", "VN", "VO", "VP", "VQ", "VR", "VS", "VT", "VU", "VV", "VW", "VX", "VY", "VZ", "WA", "WB", "WC", "WD", "WE", "WF", "WG", "WH", "WI", "WJ", "WK", "WL", "WM", "WN", "WO", "WP", "WQ", "WR", "WS", "WT", "WU", "WV", "WW", "WX", "WY", "WZ", "XA", "XB", "XC", "XD", "XE", "XF", "XG", "XH", "XI", "XJ", "XK", "XL", "XM", "XN", "XO", "XP", "XQ", "XR", "XS", "XT", "XU", "XV", "XW", "XX", "XY", "XZ", "YA", "YB", "YC", "YD", "YE", "YF", "YG", "YH", "YI", "YJ", "YK", "YL", "YM", "YN", "YO", "YP", "YQ", "YR", "YS", "YT", "YU", "YV", "YW", "YX", "YY", "YZ", "ZA", "ZB", "ZC", "ZD", "ZE", "ZF", "ZG", "ZH", "ZI", "ZJ", "ZK", "ZL", "ZM", "ZN", "ZO", "ZP", "ZQ", "ZR", "ZS", "ZT", "ZU", "ZV", "ZW", "ZX", "ZY", "ZZ" ];
      var meClass = cc.Class({
        extends: cc.Component,
        properties: {},
        onLoad: function onLoad() {},
        type: function type(obj) {
          return null == obj ? String(obj) : class2type[toString.call(obj)] || "object";
        },
        isFunction: function isFunction(obj) {
          return "function" === me.type(obj);
        },
        isArray: function isArray(obj) {
          return "array" === me.type(obj);
        },
        isPlainObject: function isPlainObject(obj) {
          return "object" === me.type(obj);
        },
        extend: function extend() {
          var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false;
          if ("boolean" === typeof target) {
            deep = target;
            target = arguments[1] || {};
            i = 2;
          }
          "object" === ("undefined" === typeof target ? "undefined" : _typeof(target)) || me.isFunction(target) || (target = {});
          if (length === i) {
            target = this;
            --i;
          }
          for (;i < length; i++) if (null != (options = arguments[i])) for (name in options) {
            src = target[name];
            copy = options[name];
            if (target === copy) continue;
            if (deep && copy && (me.isPlainObject(copy) || (copyIsArray = me.isArray(copy)))) {
              if (copyIsArray) {
                copyIsArray = false;
                clone = src && me.isArray(src) ? src : [];
              } else clone = src && me.isPlainObject(src) ? src : {};
              target[name] = me.extend(deep, clone, copy);
            } else void 0 !== copy && (target[name] = copy);
          }
          return target;
        },
        each: function each(obj, callback, args) {
          var name, i = 0, length = obj.length, isObj = void 0 === length || me.isFunction(obj);
          if (args) {
            if (isObj) {
              for (name in obj) if (false === callback.apply(obj[name], args)) break;
            } else for (;i < length; ) if (false === callback.apply(obj[i++], args)) break;
          } else if (isObj) {
            for (name in obj) if (false === callback.call(obj[name], name, obj[name])) break;
          } else for (;i < length; ) if (false === callback.call(obj[i], i, obj[i++])) break;
          return obj;
        },
        buildParams: function buildParams(prefix, obj, traditional, add) {
          var name;
          if (me.isArray(obj)) me.each(obj, function(i, v) {
            traditional || rbracket.test(prefix) ? add(prefix, v) : me.buildParams(prefix + "[" + ("object" === ("undefined" === typeof v ? "undefined" : _typeof(v)) ? i : "") + "]", v, traditional, add);
          }); else if (traditional || "object" !== me.type(obj)) add(prefix, obj); else for (name in obj) me.buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
        },
        param: function param(a, traditional) {
          var prefix, s = [], add = function add(key, value) {
            value = me.isFunction(value) ? value() : null == value ? "" : value;
            s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
          };
          if (me.isArray(a) || !me.isPlainObject(a)) me.each(a, function() {
            add(this.name, this.value);
          }); else for (prefix in a) me.buildParams(prefix, a[prefix], traditional, add);
          return s.join("&").replace(r20, "+");
        },
        ajax: function ajax(opts) {
          var xhr = cc.loader.getXMLHttpRequest();
          xhr.onreadystatechange = function() {
            if (4 === xhr.readyState && xhr.status >= 200 && xhr.status < 300) {
              var respone = xhr.responseText;
              opts.success(JSON.parse(respone));
            }
          };
          xhr.open(opts.type || "GET", opts.url, true);
          cc.sys.isNative && xhr.setRequestHeader("Accept-Encoding", "gzip,deflate");
          xhr.timeout = 5e3;
          opts.params ? xhr.send(opts.params) : xhr.send();
        },
        get: function get(opts) {
          opts.data && (opts.url = opts.url + "?" + me.param(opts.data));
          opts.type = "GET";
          return me.ajax(opts);
        },
        post: function post(opts) {
          opts.type = "POST";
          opts.params = JSON.stringify(opts.data);
          return me.ajax(opts);
        },
        parse: function parse(value) {
          if (!value) return;
          if ("number" === typeof value) return "" + value;
          if (/^\d+$/.test(value)) return value;
          var exec = /^(\d+)([A-Z][A-Z]?)$/.exec(value);
          if (!exec) {
            console.error("\u9519\u8bef\u8868\u8fbe\u5f0fn:", value);
            return;
          }
          var ui = unit.indexOf(exec[2]);
          if (ui < 0) {
            console.error("\u9519\u8bef\u8868\u8fbe\u5f0fu:", value);
            return;
          }
          var r = exec[1];
          for (var i = 0; i < ui; i++) r += "000";
          return r;
        },
        echo: function echo(value, maxLen, dig) {
          maxLen = maxLen || 3;
          dig = dig || true;
          maxLen < 3 && (maxLen = 3);
          if ("string" !== typeof value) {
            console.error("value not string!", value);
            return;
          }
          var ui = 0;
          var lastNumber = "00";
          while (value.length > maxLen) {
            lastNumber = value.slice(-3);
            value = value.slice(0, -3);
            ui++;
          }
          return this.thousands(value) + (dig ? "." + lastNumber.slice(0, 2) : "") + unit[ui];
        },
        thousands: function thousands(num) {
          var decimalPart = "";
          num = num.toString();
          if (-1 != num.indexOf(".")) {
            decimalPart = "." + num.split(".")[1];
            num = parseInt(num.split(".")[0]);
          }
          var array = num.toString().split("");
          var index = -3;
          while (array.length + index > 0) {
            array.splice(index, 0, ",");
            index -= 4;
          }
          return array.join("") + decimalPart;
        },
        add: function add(a, b) {
          var zong = [ String(this.parse(a)), String(this.parse(b)) ];
          var fen = [];
          zong = this.getMax(zong[0], zong[1]);
          zong[0] = zong[0].split("");
          zong[1] = zong[1].split("");
          var jialing;
          if (!(zong[0].length == zong[1].length)) {
            jialing = new Array(zong[0].length - zong[1].length + 1).join("0");
            zong[1] = jialing.split("").concat(zong[1]);
          }
          var next = 0;
          for (var i = zong[0].length - 1; i >= 0; i--) {
            var he = Number(zong[0][i]) + Number(zong[1][i]) + next;
            fen.unshift(he % 10);
            next = Math.floor(he / 10);
            0 != i || 0 == next || fen.unshift(next);
          }
          var result = fen.join("");
          return result;
        },
        sub: function sub(a, b) {
          var zong = [ String(this.parse(a)), String(this.parse(b)) ];
          var fen = [];
          zong = this.getMax(zong[0], zong[1]);
          if (3 == zong.length) {
            alert("\u91d1\u5e01\u4e0d\u8db3");
            return false;
          }
          zong[0] = zong[0].split("");
          zong[1] = zong[1].split("");
          var jialing;
          if (!(zong[0].length == zong[1].length)) {
            jialing = new Array(zong[0].length - zong[1].length + 1).join("0");
            zong[1] = jialing.split("").concat(zong[1]);
          }
          var next = 0;
          for (var i = zong[0].length - 1; i >= 0; i--) {
            var cha = Number(zong[0][i]) - Number(zong[1][i]) - next;
            next = 0;
            if (cha < 0) {
              cha += 10;
              next = 1;
            }
            fen.unshift(cha % 10);
          }
          var result = fen.join("");
          0 == result[0] && (result = this.shanchuling(result));
          return result;
        },
        mul: function mul(a, b) {
          var zong = [ String(this.parse(a)), String(this.parse(b)) ];
          var fen = [];
          zong = this.getMax(zong[0], zong[1]);
          zong[0] = zong[0].split("");
          zong[1] = zong[1].split("");
          for (var j = zong[1].length - 1; j >= 0; j--) {
            var next = 0;
            var fentemp = [];
            var jialing = "";
            for (var i = zong[0].length - 1; i >= 0; i--) {
              var ji = Number(zong[0][i]) * Number(zong[1][j]) + next;
              fentemp.unshift(ji % 10);
              next = Math.floor(ji / 10);
              0 != i || 0 == next || fentemp.unshift(next);
            }
            jialing = new Array(zong[1].length - (j + 1) + 1).join("0");
            fentemp.push(jialing);
            fen[j] = fentemp.join("");
          }
          var cishu = fen.length;
          for (var k = 1; k < cishu; k++) {
            var hebing = this.add(fen[0], fen[1]);
            fen.splice(0, 2, hebing);
          }
          var result = fen.join("");
          0 == result[0] && (result = this.shanchuling(result));
          return result;
        },
        isGreat: function isGreat(a, b) {
          a = this.parse(a);
          b = this.parse(b);
          if (a.length === b.length) for (var i = 0; i < a.length; i++) {
            if (a[i] > b[i]) return true;
            if (a[i] < b[i]) return false;
            if (i == a.length - 1) return true;
          }
          return a.length > b.length;
        },
        getMax: function getMax(a, b) {
          a = this.parse(a);
          b = this.parse(b);
          var result = [ a, b ];
          if (a.length < b.length) {
            result[0] = b;
            result[1] = a;
            result[2] = "not";
            return result;
          }
          if (a.length == b.length) for (var i = 0; i < a.length; i++) {
            if (result[0][i] > result[1][i]) {
              result[0] = a;
              result[1] = b;
              return result;
            }
            if (result[0][i] < result[1][i]) {
              result[0] = b;
              result[1] = a;
              result[2] = "not";
              return result;
            }
            if (i == a.length - 1) return result;
          }
          if (a.length > b.length) return result;
        },
        shanchuling: function shanchuling(result) {
          if (0 == result) {
            result = 0;
            return result;
          }
          result = result.split("");
          var hebing = result.length;
          for (var j = 0; j < hebing; j++) {
            if (0 != result[0]) break;
            result.splice(0, 1);
          }
          return result.join("");
        }
      });
      var me = new meClass();
      return me;
    }();
    cc._RF.pop();
  }, {} ],
  algorithmJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "734a4cTwzBFF5PW0vMCz3Hu", "algorithmJS");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        i: 0
      },
      hello: function hello() {
        console.log("hello!!!" + i);
        i++;
      }
    });
    cc._RF.pop();
  }, {} ],
  amountJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "fa6aeFAAu1E4KN4V4uLhqGt", "amountJS");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        amountLabel: {
          default: null,
          type: cc.Label
        },
        amount: {
          set: function set(value) {
            this._amount = value;
            this.amountLabel.string = this._amount;
          },
          get: function get() {
            return this._amount;
          }
        },
        speedLable: {
          default: null,
          type: cc.Label
        },
        speed: {
          set: function set(value) {
            this._speed = value;
            this.speedLable.string = this._speed;
          },
          get: function get() {
            return this._speed;
          }
        }
      },
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  buttonJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "e0a64AIhsdN5pbej92ADVST", "buttonJS");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        title: {
          default: null,
          type: cc.Label
        },
        text: {
          set: function set(value) {
            this.title.string = value;
          },
          get: function get() {
            return this.title.string;
          }
        }
      },
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  buyButton: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "237a5jpWaxKeqpqecZb5tuT", "buyButton");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        levelLabel: {
          default: null,
          type: cc.Label
        },
        priceLabel: {
          default: null,
          type: cc.Label
        },
        level: {
          set: function set(value) {
            this.levelLabel.string = value;
          },
          get: function get() {
            if (!this.levelLabel || !this.levelLabel.string) return "";
            return this.levelLabel.string;
          }
        },
        price: {
          set: function set(value) {
            this.priceLabel.string = value;
          },
          get: function get() {
            if (!this.priceLabel || this.priceLabel.string) return "";
            return this.priceLabel.string;
          }
        }
      },
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  itemEnableButtonJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "89affbx+ONNJ7dy5tTxsrpk", "itemEnableButtonJS");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        amountLabel: {
          default: null,
          type: cc.Label
        },
        amount: {
          set: function set(value) {
            this._amount = value;
            this.amountLabel.string = this._amount;
          },
          get: function get() {
            return this._amount;
          }
        }
      },
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  itemJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "4ccf9ouJrtKiYIoHGnOw0eM", "itemJS");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        roleNodePrefab: {
          default: null,
          type: cc.Prefab
        },
        isMask: {
          set: function set(value) {
            if (!this.roleNodeInfo) {
              var roleNode = cc.instantiate(this.roleNodePrefab);
              roleNode.parent = this.node;
              roleNode.x = 65;
              roleNode.y = -50;
              roleNode.scale = .6;
              this.roleNodeInfo = roleNode.getComponent("itemRoleJS");
            }
            this.roleNodeInfo.isMask = value;
          },
          get: function get() {
            if (this.roleNodeInfo) return this.roleNodeInfo.isMask;
            return null;
          }
        },
        level: {
          set: function set(value) {
            if (!this.roleNodeInfo) {
              var roleNode = cc.instantiate(this.roleNodePrefab);
              roleNode.parent = this.node;
              roleNode.x = 65;
              roleNode.y = -50;
              roleNode.scale = .6;
              this.roleNodeInfo = roleNode.getComponent("itemRoleJS");
            }
            this.roleNodeInfo.level = value;
          },
          get: function get() {
            if (this.roleNodeInfo) return this.roleNodeInfo.level;
            return null;
          }
        },
        levelName: {
          set: function set(value) {
            if ("" === value) {
              var roleLock = cc.instantiate(this.roleLockPrefab);
              roleLock.x = 560;
              roleLock.y = -75;
              roleLock.parent = this.node;
            } else {
              if (!this.roleNodeInfo) {
                var roleNode = cc.instantiate(this.roleNodePrefab);
                roleNode.parent = this.node;
                roleNode.x = 65;
                roleNode.y = -50;
                roleNode.scale = .6;
                this.roleNodeInfo = roleNode.getComponent("itemRoleJS");
              }
              this.roleNodeInfo.levelName = value;
            }
          },
          get: function get() {
            if (this.roleNodeInfo) return this.roleNodeInfo.levelName;
            return null;
          }
        },
        point: {
          set: function set(value) {
            if (!value) return;
            if (!this.stoneButtonInfo) {
              var stoneButton = cc.instantiate(this.stoneButtonPrefab);
              stoneButton.x = 300;
              stoneButton.y = -75;
              stoneButton.parent = this.node;
              this.stoneButtonInfo = stoneButton.getComponent("stoneButtonJS");
            }
            this.stoneButtonInfo.amount = value;
          },
          get: function get() {
            if (this.stoneButtonInfo) return this.stoneButtonInfo.amount;
            return null;
          }
        },
        price: {
          set: function set(value) {
            if (null === value) {
              var roleLock = cc.instantiate(this.roleLockPrefab);
              roleLock.x = 560;
              roleLock.y = -75;
              roleLock.parent = this.node;
              return;
            }
            if (!this.enableButtonInfo) {
              var enableButton = cc.instantiate(this.enableButtonPrefab);
              enableButton.x = 560;
              enableButton.y = -75;
              enableButton.parent = this.node;
              this.enableButton = enableButton;
              this.enableButtonInfo = enableButton.getComponent("itemEnableButtonJS");
            }
            this.enableButtonInfo.amount = value;
          },
          get: function get() {
            if (this.enableButtonInfo) return this.enableButtonInfo.amount;
            return null;
          }
        },
        enableButtonInfo: null,
        roleNodeInfo: null,
        stoneButtonInfo: null,
        enableButtonPrefab: {
          default: null,
          type: cc.Prefab
        },
        roleLockPrefab: {
          default: null,
          type: cc.Prefab
        },
        stoneButtonPrefab: {
          default: null,
          type: cc.Prefab
        }
      },
      onLoad: function onLoad() {
        var self = this;
      },
      buyRoleWithMoneyCallBack: function buyRoleWithMoneyCallBack(money, level) {},
      buyRoleWithStoneCallBack: function buyRoleWithStoneCallBack(stone, level) {},
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  itemListJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "77d70H8dQtMdZm6mILIYYHl", "itemListJS");
    "use strict";
    cc.Class({
      extends: cc.ScrollView,
      properties: {
        itemPrefab: {
          default: null,
          type: cc.Prefab
        },
        amountLabel: {
          default: null,
          type: cc.Label
        },
        content: {
          default: null,
          type: cc.Node
        },
        closeButon: {
          default: null,
          type: cc.Button
        },
        amount: {
          set: function set(value) {
            this.amountLabel.string = value;
          },
          get: function get() {
            return this.amountLabel.string;
          }
        },
        onClose: null,
        buyRoleWithMoneyCallBack: null,
        buyRoleWithStoneCallBack: null
      },
      onLoad: function onLoad() {
        this.node.zIndex = 1e3;
        var self = this;
        self.content.width = 680;
      },
      close: function close() {
        this.onClose && this.onClose(this);
        this.node.parent = null;
        this.node.destroy();
      },
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  itemRoleJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "1ac80FwnEpDEZXQkOR5/CTY", "itemRoleJS");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        levelLable: {
          default: null,
          type: cc.Label
        },
        nameLable: {
          default: null,
          type: cc.Label
        },
        levelName: {
          set: function set(value) {
            this.nameLable.string = value;
          },
          get: function get() {
            return this.nameLable.string;
          }
        },
        level: {
          set: function set(value) {
            var self = this;
            this._level = value;
            this.levelLable.string = "" + (value + 1);
            var iconStr = "role/icon_" + (value + 1);
            cc.loader.loadRes(iconStr, cc.SpriteFrame, function(err, spriteFrame) {
              self.node.getComponent(cc.Sprite).spriteFrame = spriteFrame;
            });
          },
          get: function get() {
            return this._level;
          }
        },
        isMask: {
          set: function set(value) {
            this._isMask = value;
            true === value && (this.node.color = cc.color(0, 0, 0));
          },
          get: function get() {
            return this._isMask;
          }
        }
      },
      onLoad: function onLoad() {},
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  mainScene: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "05fcbFUWnRLoozSPMmmri4F", "mainScene");
    "use strict";
    var _typeof = "function" === typeof Symbol && "symbol" === typeof Symbol.iterator ? function(obj) {
      return typeof obj;
    } : function(obj) {
      return obj && "function" === typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
    var DataState = require("DataState");
    var $ = require("Yvan");
    cc.Class({
      extends: cc.Component,
      properties: {
        topButtonsPrefab: {
          default: null,
          type: cc.Prefab
        },
        rolePrefab: {
          default: null,
          type: cc.Prefab
        },
        roleBackgroundPrefab: {
          default: null,
          type: cc.Prefab
        },
        buttonPrefab: {
          default: null,
          type: cc.Prefab
        },
        buyButtonPrefab: {
          default: null,
          type: cc.Prefab
        },
        backgroundNode: {
          default: null,
          type: cc.Node
        },
        promptChooseListPrefab: {
          default: null,
          type: cc.Prefab
        },
        amountPrefab: {
          default: null,
          type: cc.Prefab
        },
        dustbinPrefab: {
          default: null,
          type: cc.Prefab
        },
        dustbin: null,
        roleNodeArr: []
      },
      onLoad: function onLoad() {
        var self = this;
        var windowSize = cc.view.getVisibleSize();
        cc.log("width=" + windowSize.width + ",height=" + windowSize.height);
        windowSize = cc.winSize;
        cc.log("width=" + windowSize.width + ",height=" + windowSize.height);
        this.backgroundNode.setPosition(cc.p(0, (windowSize.height - this.backgroundNode.height) / 2));
        var topButtons = cc.instantiate(this.topButtonsPrefab);
        var topButtonsInfo = topButtons.getComponent("topButtonsJS");
        topButtons.setPosition(cc.p(-80, 550));
        topButtons.parent = this.node;
        topButtonsInfo.topButtonCallBack = function(buttonType) {
          "paihang" == buttonType || "libao" == buttonType || "qiandao" == buttonType || "kefu" == buttonType || "zhuanpan" == buttonType;
          console.log("\u70b9\u51fb" + buttonType);
        };
        for (var i = 0; i < 3; i++) for (var j = 0; j < 4; j++) {
          var roleBackground = cc.instantiate(this.roleBackgroundPrefab);
          roleBackground.parent = this.node;
          roleBackground.setPosition(cc.p(160 * j - 240, 110 - 190 * i));
        }
        var amountNode = cc.instantiate(this.amountPrefab);
        var amountNodeInfo = amountNode.getComponent("amountJS");
        amountNode.parent = this.node;
        amountNode.setPosition(cc.p(-170, 360));
        amountNodeInfo.text = "\u91d1\u989d";
        var speedButton = cc.instantiate(this.buttonPrefab);
        var speedButtonInfo = speedButton.getComponent("buttonJS");
        this.node.addChild(speedButton);
        speedButton.setPosition(cc.p(-250, -380));
        speedButton.width = 120;
        speedButtonInfo.text = "\u52a0\u901f";
        speedButton.on(cc.Node.EventType.TOUCH_END, function(event) {});
        var storeButton = cc.instantiate(this.buttonPrefab);
        var storeButtonInfo = storeButton.getComponent("buttonJS");
        this.node.addChild(storeButton);
        storeButton.setPosition(cc.p(120, -380));
        storeButton.width = 120;
        storeButtonInfo.text = "\u5546\u5e97";
        storeButton.on(cc.Node.EventType.TOUCH_END, this.showStoreWidget(self));
        var buyButton = cc.instantiate(this.buyButtonPrefab);
        var buyButtonInfo = buyButton.getComponent("buyButton");
        buyButton.parent = this.node;
        buyButton.setPosition(cc.p(-50, -380));
        buyButton.on(cc.Node.EventType.TOUCH_END, function(event) {
          var seatPos = self.getEmptySeat(self);
          if (seatPos < 0) {
            self.alert("\u6ca1\u6709\u7a7a\u4f59\u7684\u4f4d\u7f6e");
            return;
          }
          var r = DataState.buyRoleMax(seatPos);
          if ("string" === $.type(r)) {
            self.alert(r);
            return;
          }
          console.log("\u53ef\u4ee5\u8d2d\u4e70\u7684\u7b49\u7ea7" + r);
          self.addRoleNode(self, seatPos, r + 1);
        });
        var dustbin = cc.instantiate(this.dustbinPrefab);
        this.dustbin = dustbin;
        dustbin.setPosition(cc.p(270, -360));
        this.node.addChild(dustbin);
        self.node.on(DataState.EVENT.LOAD_SEAT, function(event) {
          self.showRoleNode(self, event.detail.seatArray);
        }, self);
        self.node.on(DataState.EVENT.MAX_ROLE_PRICE_CHANGE, function(event) {
          buyButtonInfo.price = $.echo(event.detail.maxRolePrice);
          buyButtonInfo.level = "LV " + (event.detail.maxRoleLevel + 1);
        }, buyButton);
        self.node.on(DataState.EVENT.MONEY_CHANGE, function(event) {
          amountNodeInfo.amount = " $" + $.echo(event.detail, 6, true);
        }, amountNode);
        DataState.load(self, "1");
      },
      showStoreWidget: function showStoreWidget(self) {
        return function(event) {
          var roleChooseList = cc.instantiate(self.promptChooseListPrefab);
          var roleChooseListInfo = roleChooseList.getComponent("itemListJS");
          roleChooseList.parent = self.node;
          roleChooseList.x = 0;
          roleChooseList.y = 30;
          roleChooseListInfo.amount = " $" + $.echo(DataState.state.money, 3, true);
          var buyRole = function buyRole(useWhat, level) {
            var seatPos = self.getEmptySeat(self);
            if (seatPos < 0) {
              self.alert("\u6ca1\u6709\u7a7a\u4f59\u7684\u4f4d\u7f6e");
              return;
            }
            var r = DataState.buyRole(useWhat, level, seatPos);
            if ("string" === $.type(r)) {
              self.alert(r);
              return;
            }
            self.addRoleNode(self, seatPos, level);
          };
          var eventList = DataState.getPriceList();
          var _loop = function _loop(i) {
            var item = cc.instantiate(roleChooseListInfo.itemPrefab);
            var itemInfo = item.getComponent("itemJS");
            itemInfo.level = i;
            itemInfo.isMask = eventList[i].mask;
            if (itemInfo.isMask) itemInfo.levelName = ""; else {
              itemInfo.levelName = eventList[i].levelName;
              if (eventList[i].point) {
                itemInfo.point = $.echo(eventList[i].point);
                (function(i) {
                  itemInfo.stoneButtonInfo.node.on(cc.Node.EventType.TOUCH_END, function(event) {
                    buyRole("point", i);
                  });
                })(i);
              } else itemInfo.point = null;
              if (eventList[i].price) {
                itemInfo.price = $.echo(eventList[i].price);
                (function(i) {
                  itemInfo.enableButtonInfo.node.on(cc.Node.EventType.TOUCH_END, function(event) {
                    buyRole("price", i);
                  });
                })(i);
              } else itemInfo.price = null;
            }
            item.x = -340;
            eventList[i].itemInfo = itemInfo;
            roleChooseListInfo.content.addChild(item);
          };
          for (var i = 0; i < eventList.length; i++) _loop(i);
          roleChooseListInfo.content.height = 150 * eventList.length + 149;
          self.node.on(DataState.EVENT.MONEY_CHANGE, function(event) {
            roleChooseListInfo.amount = " $" + $.echo(event.detail, 3, true);
          }, roleChooseList);
          self.node.on(DataState.EVENT.ROLE_PRICE_CHANGE, function(event) {
            if (eventList[event.detail.roleLevel].mask) return;
            var price = DataState.getPrice(event.detail.roleLevel);
            var point = DataState.getPoint(event.detail.roleLevel);
            eventList[event.detail.roleLevel].itemInfo.price = price ? $.echo(price) : null;
            eventList[event.detail.roleLevel].itemInfo.point = point ? $.echo(point) : null;
          }, roleChooseList);
          roleChooseListInfo.onClose = function(me) {
            console.log("mainSceneClose");
          };
          roleChooseListInfo.buyRoleWithMoneyCallBack = function(money, level) {
            console.log("buy use money", money, level);
          };
          roleChooseListInfo.buyRoleWithStoneCallBack = function(money, level) {
            console.log("buy use point", money, level);
          };
        };
      },
      itermMoveEnd: function itermMoveEnd(node) {
        var me = this;
        return function(node) {
          if (node.x > me.dustbin.x - 50 & node.x < me.dustbin.x + 50 & node.y > me.dustbin.y - 50 & node.y < me.dustbin.y + 50) {
            console.log("\u5220\u9664");
            for (var i = 0; i < me.roleNodeArr.length; i++) {
              var element = me.roleNodeArr[i];
              if (element === node) {
                me.roleNodeArr[i] = -1;
                node.parent = null;
                node.destroy();
                DataState.merge(me.getSeatArray());
              }
            }
            return false;
          }
          var _loop2 = function _loop2(_i) {
            var element = me.roleNodeArr[_i];
            if (element != node && -1 != element) {
              if (node.x > element.x - 50 & node.x < element.x + 50 & node.y > element.y - 50 & node.y < element.y + 50) {
                elementInfo = element.getComponent("workRoleJS");
                nodeInfo = node.getComponent("workRoleJS");
                if (elementInfo.text == nodeInfo.text) {
                  node.x = element.x;
                  node.y = element.y;
                  tempNode = cc.instantiate(me.rolePrefab);
                  tempNodeInfo = tempNode.getComponent("workRoleJS");
                  tempNode.parent = me.node;
                  tempNode.setPosition(cc.p(element.x, element.y));
                  tempNodeInfo.text = elementInfo.text;
                  tempNode.zIndex = 101;
                  element.zIndex = 101;
                  actionTo = cc.moveBy(.2, cc.v2(100, 0));
                  actionback = cc.moveBy(.1, cc.v2(-100, 0));
                  actionTo1 = cc.moveBy(.2, cc.v2(-100, 0));
                  actionback1 = cc.moveBy(.1, cc.v2(100, 0));
                  ca = cc.sequence(actionTo1, actionback1, cc.callFunc(function() {
                    element.parent = null;
                    element.destroy();
                  }));
                  ac = cc.sequence(actionTo, actionback, cc.callFunc(function() {
                    nodeInfo.text = parseInt(nodeInfo.text) + 1;
                    for (var x = 0; x < me.roleNodeArr.length; x++) {
                      var element1 = me.roleNodeArr[x];
                      element1 == node && (me.roleNodeArr[x] = -1);
                    }
                    me.roleNodeArr[_i] = node;
                    tempNode.parent = null;
                    tempNode.destroy();
                    me.addEffect(node);
                    DataState.merge(me.getSeatArray(), true, _i);
                  }));
                  tempNode.runAction(ac);
                  element.runAction(ca);
                  return {
                    v: true
                  };
                }
                return {
                  v: false
                };
              }
            } else if (-1 == element) {
              var xx = _i % 4 * 160 - 230;
              var yy = 180 - 190 * parseInt(_i / 4);
              if (node.x > xx - 50 & node.x < xx + 50 & node.y > yy - 50 & node.y < yy + 50) {
                node.x = xx;
                node.y = yy;
                for (var x = 0; x < me.roleNodeArr.length; x++) {
                  var element1 = me.roleNodeArr[x];
                  element1 == node && (me.roleNodeArr[x] = -1);
                }
                me.roleNodeArr[_i] = node;
                DataState.merge(me.getSeatArray());
                return {
                  v: true
                };
              }
            }
          };
          for (var _i = me.roleNodeArr.length - 1; _i >= 0; _i--) {
            var elementInfo;
            var nodeInfo;
            var tempNode;
            var tempNodeInfo;
            var actionTo;
            var actionback;
            var actionTo1;
            var actionback1;
            var ca;
            var ac;
            var _ret2 = _loop2(_i);
            if ("object" === ("undefined" === typeof _ret2 ? "undefined" : _typeof(_ret2))) return _ret2.v;
          }
          console.log(node.x, node.y, me.roleNodeArr.length);
          return false;
        };
      },
      getSeatArray: function getSeatArray() {
        return this.roleNodeArr.map(function(n) {
          if (-1 === n) return -1;
          return parseInt(n.getComponent("workRoleJS").text) - 1;
        });
      },
      itermMove: function itermMove(node) {
        var me = this;
        return function(node) {};
      },
      itermTouch: function itermTouch(node) {
        var me = this;
        return function(node) {
          for (var i = me.roleNodeArr.length - 1; i >= 0; i--) {
            var element = me.roleNodeArr[i];
            element != node && -1 != element && (element.zIndex = 99);
          }
        };
      },
      addEffect: function addEffect(node) {
        var nodeEffect = new cc.Node();
        nodeEffect.name = "nodeEffect";
        var sprite = nodeEffect.addComponent(cc.Sprite);
        sprite.spriteFrame = new cc.SpriteFrame(cc.url.raw("resources/effect/effect_1.png"));
        nodeEffect.parent = this.node;
        nodeEffect.x = node.x;
        nodeEffect.y = node.y;
        nodeEffect.zIndex = 102;
        var animation = nodeEffect.addComponent(cc.Animation);
        var frames = [];
        frames[0] = new cc.SpriteFrame(cc.url.raw("resources/effect/effect_1.png"));
        frames[1] = new cc.SpriteFrame(cc.url.raw("resources/effect/effect_2.png"));
        frames[2] = new cc.SpriteFrame(cc.url.raw("resources/effect/effect_3.png"));
        frames[3] = new cc.SpriteFrame(cc.url.raw("resources/effect/effect_4.png"));
        frames[4] = new cc.SpriteFrame(cc.url.raw("resources/effect/effect_5.png"));
        frames[5] = new cc.SpriteFrame(cc.url.raw("resources/effect/effect_6.png"));
        frames[6] = new cc.SpriteFrame(cc.url.raw("resources/effect/effect_7.png"));
        var clip = cc.AnimationClip.createWithSpriteFrames(frames, 7);
        clip.name = "anim_boom";
        clip.wrapMode = cc.WrapMode.Default;
        clip.speed = 2;
        animation.addClip(clip);
        animation.play("anim_boom");
      },
      start: function start() {},
      showRoleNode: function showRoleNode(self, roleLevelArr) {
        for (var i = 0; i < roleLevelArr.length; i++) {
          var element = roleLevelArr[i];
          if (element < 0) {
            self.roleNodeArr.push(-1);
            continue;
          }
          self.maxLevel < element && (self.maxLevel = element);
          var roleNode = cc.instantiate(self.rolePrefab);
          var roleNodeInfo = roleNode.getComponent("workRoleJS");
          roleNode.parent = self.node;
          roleNode.setPosition(cc.p(i % 4 * 160 - 230, 180 - 190 * parseInt(i / 4)));
          roleNode.scale = 1;
          roleNodeInfo.text = element + 1 + "";
          roleNodeInfo.moveEndCallBack = self.itermMoveEnd();
          roleNodeInfo.moveCallBack = self.itermMove();
          roleNodeInfo.touchCallBack = self.itermTouch();
          self.roleNodeArr.push(roleNode);
        }
      },
      getEmptySeat: function getEmptySeat(self) {
        for (var i = 0; i < self.roleNodeArr.length; i++) if (-1 == self.roleNodeArr[i]) return i;
        return -1;
      },
      alert: function alert(msg) {
        console.error(msg);
      },
      addRoleNode: function addRoleNode(self, seatPos, level) {
        var roleNode = cc.instantiate(self.rolePrefab);
        var roleNodeInfo = roleNode.getComponent("workRoleJS");
        roleNode.parent = self.node;
        roleNode.setPosition(cc.p(seatPos % 4 * 160 - 230, 180 - 190 * parseInt(seatPos / 4)));
        roleNode.scale = 1;
        roleNodeInfo.text = level + "";
        roleNodeInfo.moveEndCallBack = self.itermMoveEnd();
        roleNodeInfo.moveCallBack = self.itermMove();
        roleNodeInfo.touchCallBack = self.itermTouch();
        self.roleNodeArr[seatPos] = roleNode;
      }
    });
    cc._RF.pop();
  }, {
    DataState: "DataState",
    Yvan: "Yvan"
  } ],
  stoneButtonJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "3038eji7KpIA78zGqlOo6vh", "stoneButtonJS");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        amountLabel: {
          default: null,
          type: cc.Label
        },
        amount: {
          set: function set(value) {
            this._amount = value;
            this.amountLabel.string = this._amount;
          },
          get: function get() {
            return this._amount;
          }
        }
      },
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  topButtonsJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "471fcpQmmpL1IjnDyTq0e42", "topButtonsJS");
    "use strict";
    cc.Class({
      extends: cc.Component,
      properties: {
        paihang: {
          default: null,
          type: cc.Button
        },
        libao: {
          default: null,
          type: cc.Button
        },
        qiandao: {
          default: null,
          type: cc.Button
        },
        kefu: {
          default: null,
          type: cc.Button
        },
        zhuanpan: {
          default: null,
          type: cc.Button
        }
      },
      onLoad: function onLoad() {
        var self = this;
        this.paihang.node.on(cc.Node.EventType.TOUCH_END, function(event) {
          self.topButtonCallBack("paihang");
        });
        this.libao.node.on(cc.Node.EventType.TOUCH_END, function(event) {
          self.topButtonCallBack("libao");
        });
        this.qiandao.node.on(cc.Node.EventType.TOUCH_END, function(event) {
          self.topButtonCallBack("qiandao");
        });
        this.kefu.node.on(cc.Node.EventType.TOUCH_END, function(event) {
          self.topButtonCallBack("kefu");
        });
        this.zhuanpan.node.on(cc.Node.EventType.TOUCH_END, function(event) {
          self.topButtonCallBack("zhuanpan");
        });
      },
      topButtonCallBack: function topButtonCallBack(buttonType) {},
      start: function start() {}
    });
    cc._RF.pop();
  }, {} ],
  workRoleJS: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "aa098JdSxZFfLLXryN8lHl/", "workRoleJS");
    "use strict";
    var DataState = require("DataState");
    cc.Class({
      extends: cc.Component,
      properties: {
        level: {
          default: null,
          type: cc.Label
        },
        makeMoneyLable: {
          default: null,
          type: cc.Label
        },
        text: {
          set: function set(value) {
            this._text = value;
            this.level.string = this._text;
            var self = this;
            var iconStr = "role/icon_" + this.text;
            cc.loader.loadRes(iconStr, cc.SpriteFrame, function(err, spriteFrame) {
              self.node.getComponent(cc.Sprite).spriteFrame = spriteFrame;
            });
            this.unschedule(this.makeMoney);
            var interval = DataState.getMakeMoneyInterval(parseInt(value) - 1);
            interval > 0 && this.schedule(this.makeMoney, interval / 1e3, 9999999, 0);
          },
          get: function get() {
            return this._text;
          }
        },
        oldPosition: {
          default: null,
          type: cc.Vec2
        }
      },
      makeMoney: function makeMoney() {
        var self = this;
        var scale1 = cc.scaleTo(.1, 1.2);
        var scale2 = cc.scaleTo(.1, 1);
        var scale3 = cc.scaleTo(.05, 1.1);
        var scale4 = cc.scaleTo(.05, 1);
        var ss = cc.sequence(scale1, scale2, scale3, scale4);
        this.node.runAction(ss);
        var money = DataState.makeMoney(parseInt(this._text) - 1);
        var fadeIn = cc.fadeIn(.1);
        var actionTo = cc.moveBy(.2, cc.v2(0, 100));
        var actionStay = cc.moveBy(.7, cc.v2(0, 0));
        var fadeOut = cc.fadeOut(.1);
        var appear = cc.spawn(fadeIn, actionTo);
        var ca = cc.sequence(appear, actionStay, fadeOut, cc.callFunc(function() {
          self.makeMoneyLable.node.y = 0;
        }));
        this.makeMoneyLable.node.runAction(ca);
        this.makeMoneyLable.string = "+" + money;
      },
      onLoad: function onLoad() {
        this.oldPosition = new cc.Vec2(this.node.x, this.node.y);
        var self = this;
        var anim = this.getComponent(cc.Animation);
        this.node.on(cc.Node.EventType.TOUCH_START, function(event) {
          self.oldPosition.x = this.x;
          self.oldPosition.y = this.y;
          this.zIndex = 100;
          self.touchCallBack(self.node);
        }, this.node);
        this.node.on(cc.Node.EventType.TOUCH_MOVE, function(event) {
          this.opacity = 255;
          var delta = event.touch.getDelta();
          this.x += delta.x;
          this.y += delta.y;
          this.zIndex = 100;
          self.moveCallBack(self.node);
        }, this.node);
        this.node.on(cc.Node.EventType.TOUCH_END, function(event) {
          this.opacity = 255;
          var delta = event.touch.getDelta();
          if (self.moveEndCallBack(self.node)) anim.play(); else {
            this.x = self.oldPosition.x;
            this.y = self.oldPosition.y;
          }
        }, this.node);
      },
      touchCallBack: function touchCallBack(node) {},
      moveCallBack: function moveCallBack(node) {},
      moveEndCallBack: function moveEndCallBack(node) {},
      loadImage: function loadImage() {},
      start: function start() {}
    });
    cc._RF.pop();
  }, {
    DataState: "DataState"
  } ]
}, {}, [ "DataState", "HelloWorld", "Yvan", "amountJS", "buttonJS", "buyButton", "itemEnableButtonJS", "itemJS", "itemListJS", "itemRoleJS", "stoneButtonJS", "topButtonsJS", "workRoleJS", "mainScene", "algorithmJS" ]);